<div class="grid_7">
    <div class="box">
        <h2>
            <a href="#" id="toggle-tables">SPECIFICATION MANAGEMENT |  
                <?= $this->management_model->get_version('CAR', $version_id)->version; ?> 
            </a>
        </h2>
        <div class="block" >
            <form name="admin-form" action="<?= base_url(); ?>admin/management/version_specification_insert" method="post">
                <fieldset>
                    <legend>SPECIFICATION </legend>
                    <div class="field" >
                        <?php
                        if ($this->session->flashdata('message')) {
                            $msg = $this->session->flashdata('message');
                            echo '<font color="red">' . $msg . '</font>';
                        }
                        ?> 
                    </div>
                    <div class="field" style="float:left; margin-right: 5px;">
                        <label> Select Specification</label>
                        <select name="specification" style="width: 250px">
                            <option value="" seleted="selected"> Select Specification</option>
                            <?php foreach ($specification as $specification): ?>
                                <option value="<?= $specification->slno . ',' . $specification->code ?>"> <?= $specification->specification; ?> </option>
                            <?php endforeach; ?>
                        </select>
                    </div> 
                    <div class="field" style="float:left;">
                        <label>Specification Value </label>
                        <input type="text" name="specification_value" value="" size="40"/>
                        <input type="hidden" name="version_id" value="<?= $version_id; ?>"/>
                        <input type="hidden" name="model_id" value="<?= $model_id; ?>"/>
                        <input type="hidden" name="make_id" value="<?= $make_id; ?>"/>
                        <input type="submit" value="Add Now" name="insert_specification"/>
                    </div>
                    <div style="float:right;">
                        <?php
                        $img = $this->management_model->get_version_image('CAR', $version_id);
                        if ($img != '') {
                            ?>
                            <img style="border: 1px solid #CCC; padding: 3px; float: right" src="<?= base_url() ?>assets/images/data/car/version/<?= $img; ?>" height="75" width="150" />
                        <?php } ?>
                    </div>
                </fieldset>
            </form>
            <?php
            //print_r($version_specification_code);
            //die();
            
            foreach ($version_specification_code as $version_specification_code):
                $version_specifications = $this->management_model->get_specification_by_version_id('CAR', $version_id, $version_specification_code->code);
                ?>
                <fieldset>
                    <legend id="red">
                        <?= $this->management_model->specification_type($version_specification_code->code); ?> :
                    </legend>
                    <?php foreach ($version_specifications as $version_specifications): ?>
                        <div class="field">
                            <input type="text" size="70" disabled="disabled" value="<?= $version_specifications->specification; ?>"/>
                            <input type="text" size="40" disabled="disabled" value="<?= $this->management_model->get_specification_value('CAR', $version_specifications->slno, $version_specification_code->code); ?>"/>
                            <a href="<?= base_url(); ?>admin/management/delete_specification/<?= $version_specification_code->code; ?>/<?= $version_specifications->slno; ?>/<?= $make_id; ?>/<?= $model_id; ?>/<?= $version_id; ?>" class="link-button" style="float: right" onclick="return confirm('Are you sure you want to Delete?')"> Delete </a>
                        </div>
                    <?php endforeach; ?>
                </fieldset>
            <?php endforeach; ?>
        </div>
    </div> <!-- END OF BOX -->
</div>